Arrays

An array is a matrix of cells that contain real or integer values. Each cell in an array works much like a variable, and a reference to a cell in an array can be used anywhere a variable can be used. A one-dimensional array may be thought of as a single column of values. A two-dimensional array is like having multiple columns of values (similar to a spreadsheet).

To reference a cell in a one-dimensional array, give the name of the array and enclose the cell number in brackets. For example, if a one-dimensional array containing ten cells is named OpnArray, to reference the fifth cell you would use OpnArray[5]. To reference a cell in a two-dimensional array, simply use the name of the array with the row and column number in brackets. For example, the statement OpnArray[3,4] references a cell on the third row in the fourth column.

Arrays with more than two dimensions are more difficult to picture, but work exactly the same as one and two dimensional arrays. For example, if an array has a third dimension, you can reference any cell simply by adding a comma before the number of the desired cell in the third dimension. For example, Tool[3,5,8]. Four and five-dimensional arrays work the same way. The maximum number of dimensions for an array is 20.

Array cell values are assigned in the exact same way as you would assign a value to a variable. For example, to assign the value 18 to the cell at the fifth row and second column in an array named Arr1 you would use the following statement.

Assign array cell value

Arr1[5,2]=18

Arrays are defined in the Arrays editor accessed through the Build menu.

 

How to use the arrays editor:

1. Select Arrays from the Build menu.